package com.weifangfirecontrolformal.weifangfirecontrolformal.web.web.check.checkaddr;

import cn.hutool.json.JSONObject;
import com.weifangfirecontrolformal.weifangfirecontrolformal.common.base.BaseController;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.annotaion.Action;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.annotaion.At;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.model.RespEntity;
import com.weifangfirecontrolformal.weifangfirecontrolformal.web.service.check.checkaddr.CheckaddrService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;

/**
 * 巡检点控制器
 */
@Action
@RequestMapping(value="check/checkaddr")
public class CheckaddrController extends BaseController {
    @Resource
    public CheckaddrService checkaddrService;

    /**
     * 巡检点类型树形列表
     * @param
     * @return
     */
    @At(value = "checkaddrTypeList", method = RequestMethod.GET)
    public RespEntity checkaddrTypeList(@RequestBody(required = false) JSONObject jsonParam) {
        return checkaddrService.checkaddrTypeList(jsonParam);
    }

    /**
     * 巡检点列表
     * @param
     * page	第几页
     * businessId	单位id：如果是机构用户登录需要传,如果是单位用户自己取
     * partition	分区id
     * seat	位置id
     * type	巡查点类型
     * isHaveRfid	是否有RFID：布尔类型
     * limit	每页多少条
     * @return
     */
    @At(value = "checkaddrListPage", method = RequestMethod.GET, param = { "page","limit"})
    public RespEntity checkaddrListPage(@RequestBody(required = false) JSONObject jsonParam) {
        return checkaddrService.checkaddrListPage(jsonParam);
    }

    /**
     * 巡检点详情
     * @param
     * id	巡检点的id
     * @return
     */
    @At(value = "checkaddrDetail", method = RequestMethod.GET, param = { "id"})
    public RespEntity checkaddrDetail(@RequestBody(required = false) JSONObject jsonParam) {
        return checkaddrService.checkaddrDetail(jsonParam);
    }

    /**
     * 巡检点新增
     * @param
     * type	巡查点类型
     * partition	分区id
     * seat	位置id
     * addr	详细地址
     * rfid	RFID码
     * @return
     */
    @At(value = "checkaddrAdd", method = RequestMethod.POST, param = { "type","partition","seat" })
    public RespEntity checkaddrAdd(@RequestBody(required = false) JSONObject jsonParam) {
        return checkaddrService.checkaddrAdd(jsonParam);
    }

    /**
     * 巡检点修改
     * @param
     * type	巡查点类型
     * partition	分区id
     * seat	位置id
     * addr	详细地址
     * rfid	RFID码
     * id	巡检点id
     * @return
     */
    @At(value = "checkaddrUpdate", method = RequestMethod.POST, param = {"type","partition","seat", "id" })
    public RespEntity checkaddrUpdate(@RequestBody(required = false) JSONObject jsonParam) {
        return checkaddrService.checkaddrUpdate(jsonParam);
    }

    /**
     * 巡检点删除
     * @param
     * id	巡检点的id
     * @return
     */
    @At(value = "checkaddrDelete", method = RequestMethod.POST, param = { "id" })
    public RespEntity checkaddrDelete(@RequestBody(required = false) JSONObject jsonParam) {
        return checkaddrService.checkaddrDelete(jsonParam);
    }

    /**
     * 字典组查询
     * @param
     * groupname	字典组
     * @return
     */
    @At(value = "dictList", method = RequestMethod.GET, param = {"groupname" })
    public RespEntity dictList(@RequestBody(required = false) JSONObject jsonParam) {
        return checkaddrService.dictList(jsonParam);
    }

    /**
     * 巡检点类型树形列表
     * @param
     * @return
     */
    @At(value = "checkaddrTreeList", method = RequestMethod.GET)
    public RespEntity checkaddrTreeList(@RequestBody(required = false) JSONObject jsonParam) {
        return checkaddrService.checkaddrTreeList(jsonParam);
    }






   
}